<script type="text/javascript">
$(document).ready(function(){
	$("#save").on("click",function(){
		var repassword = $("input[name='repassword']").val();
		
		var name = $("input[name='name']").val();
		var password = $("input[name='password']").val();
		var sex = $('input:radio[name="sex"]:checked').val();
		var status = $('input:radio[name="status"]:checked').val();
		var realName = $("input[name='realName']").val();
		var phone = $("input[name='phone']").val();
		var companyId = $("#companyId").find("option:selected").val();
		var recom_com_id = $("#recom_com_id").find("option:selected").val();
		var address = $("input[name='address']").val();
		var email = $("input[name='email']").val();
		var IDcard = $("input[name='IDcard']").val();
		var major_id = $("#majorId").find("option:selected").val();
		var position_id = $("#position_id").find("option:selected").val();
		var degree_id = $("#degree_id").find("option:selected").val();
		
		if(repassword != password){
			alert("两次输入密码不一致");
		} else {
			$.post("${path}/expert/add",{
				name:name,
				password:password,
				sex:sex,
				status:status,
				realName:realName,
				phone:phone,
				companyId:companyId,
				recom_com_id:recom_com_id,
				address:address,
				email:email,
				IDcard:IDcard,
				major_id:major_id,
				position_id:position_id,
				degree_id:degree_id
			},function(data){
				if(data.success){
					window.location.href = "${path}/expert/list";
				}
			})
		}
	});
});
</script>
<div>
	登录名：<input name="name"> <br/>
	密码：<input name="password"> <br/>
	确认密码：<input name="repassword"> <br/>
	姓名：<input name="realName"> <br/>
	性别：<input id="x1" type="radio" value="0" name="sex" checked/>男
		  <input id="x2" type="radio" value="1" name="sex"/>女  <br/>
	身份证号：<input name="IDcard"><br/>
	邮箱：<input name="email" value=""><br/>
	现从事专业：
	<select id="majorId" name="">
	     <option value=" " >请选择</option>
	     #foreach ($major in $map.major)
	        <option value="${major.id}"> ${major.name}</option>
		  #end 
	</select><br/>
	工作单位：
	<select id="companyId" name="">
	     <option value=" " >请选择</option>
	     #foreach ($company in $map.company)
	        <option value="${company.id}"> ${company.name}</option>
		  #end 
	</select><br/>
	所在地：<input name="address" value=""><br/>
	职称：
	<select id="position_id" name="">
	     <option value=" " >请选择</option>
	     #foreach ($position in $map.position)
	        <option value="${position.id}"> ${position.name}</option>
		  #end 
	</select><br/>
	学历：
	<select id="degree_id" name="">
	     <option value=" " >请选择</option>
	     #foreach ($degree in $map.degree)
	        <option value="${degree.id}"> ${degree.name}</option>
		  #end 
	</select><br/>
	联系电话：<input name="phone"><br/>
	状态：<input id="z1" type="radio" value="0" name="status" checked/>正常启用
		  <input id="z2" type="radio" value="1" name="status"/>异常  <br/>
	推荐单位：
	<select id="recom_com_id" name="">
	     <option value=" " >请选择</option>
	     #foreach ($company in $map.company)
	        <option value="${company.id}"> ${company.name}</option>
		  #end 
	</select><br/>
	<button id="save">保存 </button>
</div>